package lesson2;

import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;

public class Demo3 {
    public static void main(String[] args) throws IOException, InterruptedException {
        File file1 = new File("abc/efg/123.txt");
        //获取文件的父路径
        //System.out.println(file1.getParentFile().getAbsolutePath());
        if(!file1.getParentFile().exists()){
            file1.getParentFile().mkdirs();
        }

        file1.createNewFile();
//        Thread.sleep(5*1000);
//        file1.deleteOnExit();
        long lastModify = file1.lastModified();
        Date date = new Date(lastModify);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS");
        System.out.println(simpleDateFormat.format(date));
    }
}
